import Section from '@/pages/Myantd/Form/Layout/Section';
import TestFileds, { localFieldConfig } from './TestFileds';
import { Button, Form, Input, Select, Space } from 'antd';
import ActionBtn from '@/pages/Myantd/Form/ActionBtn';
import { connect } from 'dva';
import { useEffect } from 'react';
import BtnConfig from './BaseF.acton.config';



export default connect()(
  ({ dispatch }: any) => {
    const [form] = Form.useForm()
    const formId = 'SectionID_3'
    //根据form item 的 name属性对应去map filed
    const initialValues = {
      Adress: '111',
      BirthDate: '2001/10/11',
      BirthDateRange: ['2011/10/11', '2022/12/13'],
      BirthDateSelect: 'Jack',
    };

    //初始化的时候set按钮的配置
    useEffect(() => {
      dispatch({
        type: 'forms/setBtnConfig',
        payload: {
          BtnConfig
        }
      })
    }, [])

    return (
      <>
        <Section
          SectionID={formId}
          initialValues={initialValues}
          fieldConfigs={localFieldConfig}
        >
          <TestFileds.Name />
          <TestFileds.Age />
          <TestFileds.Adress />
          <TestFileds.BirthDate />
          <TestFileds.BirthDateRange />
          <TestFileds.BirthDateSelect />
        </Section>

        <ActionBtn></ActionBtn>
      </>
    );
  });

